<template>
  <div class="main">
    <div class="top">
      <div class="top_top">
        <div class="blueI"></div>
        <span class="text20" style="margin-right: 20px">合格</span>
        <div class="blueII"></div>
        <span class="text20">待检</span>
      </div>
      <div class="top_main">
        <div v-for="(item, index) in list" :key="index">
          <div class="title">
            {{ item.aggregate_name }}
          </div>
          <div class="title_s">
            {{ item.aggregate_specification }}
          </div>
          <div class="bg">
            <div
              :class="{ or0: item.state == 0 }"
              class="bgBottom"
              :style="{
                height: `${
                  ((200 - 6 - 20) * item.aggregate_count) / 1300 > 1300
                    ? 175
                    : ((200 - 6 - 20) * item.aggregate_count) / 1300
                }px`,
              }"
            >
              <div class="bgTop" :class="{ oa0: item.state == 0 }">
                {{ item.aggregate_count }}T
              </div>
            </div>
          </div>
          <div class="title_b">
            {{ item.aggregate_warehouse }}
          </div>
        </div>
      </div>
    </div>
    <div class="bottom">
      <div class="bottom_main" align="center">
        <div style="position: absolute; left: -115px" class="four_b">
          <div class="bei4">
            细骨料
            <br />
            <span class="sizeS">5-16mm</span>
          </div>
          <div class="bei3">
            粗骨料
            <br />
            <span class="sizeS">16-31.5mm</span>
          </div>
          <div class="bei2">
            细骨料
            <br />
            <span class="sizeS">中砂</span>
          </div>
          <div class="bei1">
            备用
            <br />
            <span class="sizeS" style="visibility: hidden">16-31.5mm</span>
          </div>
        </div>

        <div style="position: absolute; right: -115px" class="four_b">
          <div class="bei1">
            备用
            <br />
            <span class="sizeS" style="visibility: hidden">16-31.5mm</span>
          </div>
          <div class="bei2">
            细骨料
            <br />
            <span class="sizeS">中砂</span>
          </div>
          <div class="bei3">
            粗骨料
            <br />
            <span class="sizeS">16-31.5mm</span>
          </div>
          <div class="bei4">
            细骨料
            <br />
            <span class="sizeS">5-16mm</span>
          </div>
        </div>

        <span
          class="sn2_3 yaa"
          :class="{ yellea: snList[13].state == 0 }"
          style="position: absolute; right: 72px; top: 370px"
        >
          {{ bottonList[13] }}%
        </span>

        <span
          class="sn1_3 yaa"
          :class="{ yellea: snList[6].state == 0 }"
          style="position: absolute; left: 71px; top: 370px"
        >
          {{ bottonList[6] }}%
        </span>

        <span
          class="sn1_5 yaa"
          :class="{ yellea: snList[8].state == 0 }"
          style="position: absolute; left: 51px; top: 236px"
        >
          {{ bottonList[8] }}%
        </span>

        <span
          class="sn2_5 yaa"
          :class="{ yellea: snList[15].state == 0 }"
          style="position: absolute; right: 51px; top: 236px"
        >
          {{ bottonList[15] }}%
        </span>

        <span
          class="sn1_7 ya"
          :class="{ yelle: snList[10].state == 0 }"
          style="position: absolute; left: 221px; top: 115px"
        >
          {{ bottonList[10] }}%
        </span>

        <span
          class="sn2_7 ya"
          :class="{ yelle: snList[17].state == 0 }"
          style="position: absolute; right: 224px; top: 115px"
        >
          {{ bottonList[17] }}%
        </span>

        <span
          class="sn2_2 ya"
          :class="{ yelle: snList[12].state == 0 }"
          style="position: absolute; right: 289px; top: 400px"
        >
          {{ bottonList[12] }}%
        </span>

        <span
          class="sn1_2 ya"
          :class="{ yelle: snList[5].state == 0 }"
          style="position: absolute; left: 289px; top: 400px"
        >
          {{ bottonList[5] }}%
        </span>

        <span
          class="sn2_1 ya"
          :class="{ yelle: snList[11].state == 0 }"
          style="position: absolute; right: 434px; top: 437px"
        >
          {{ bottonList[11] }}%
        </span>

        <span
          class="sn1_1 ya"
          :class="{ yelle: snList[4].state == 0 }"
          style="position: absolute; left: 433px; top: 438px"
        >
          {{ bottonList[4] }}%
        </span>

        <span
          class="sn2_6 ya"
          :class="{ yelle: snList[16].state == 0 }"
          style="position: absolute; right: 204px; top: 197px"
        >
          {{ bottonList[16] }}%
        </span>

        <span
          class="sn1_6 ya"
          :class="{ yelle: snList[9].state == 0 }"
          style="position: absolute; left: 203px; top: 197px"
        >
          {{ bottonList[9] }}%
        </span>

        <span
          class="sn2_4 ya"
          :class="{ yelle: snList[14].state == 0 }"
          style="position: absolute; right: 220px; top: 300px"
        >
          {{ bottonList[14] }}%
        </span>

        <span
          class="sn1_4 ya"
          :class="{ yelle: snList[7].state == 0 }"
          style="position: absolute; left: 220px; top: 300px"
        >
          {{ bottonList[7] }}%
        </span>

        <span
          class="fmh2_2 ya"
          :class="{ yelle: snList[3].state == 0 }"
          style="position: absolute; right: 430px; top: 17px"
        >
          {{ bottonList[3] }}%
        </span>

        <span
          class="fmh1_2 ya"
          :class="{ yelle: snList[1].state == 0 }"
          style="position: absolute; left: 430px; top: 17px"
        >
          {{ bottonList[1] }}%
        </span>

        <span
          class="fmh2_1 ya"
          :class="{ yelle: snList[2].state == 0 }"
          style="position: absolute; right: 296px; top: 43px"
        >
          {{ bottonList[2] }}%
        </span>

        <span
          class="fmh1_1 ya"
          :class="{ yelle: snList[0].state == 0 }"
          style="position: absolute; left: 296px; top: 43px"
        >
          {{ bottonList[0] }}%
        </span>

        <img src="../../assets/img/title/liaocc.png" alt="" />
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      value: true,
      // 柱状图数据
      list: [],
      bottonList: [],
      snList: [],
      switch7: [{}, {}, {}, {}, {}, {}, {}],
    };
  },
  created() {},
  mounted() {
    this.$api
      .AggregateFindAggregate({
        user_id: localStorage.getItem("user_id"),
      })
      .then((res) => {

        this.list = res.data;
      })
      .catch(() => {});

    this.$api
      .PowderFindPowder({
        user_id: localStorage.getItem("user_id"),
      })
      .then((res) => {
   
        let data = res.data;
        this.snList = res.data;
       
        for (let i = 0; i < data.length; i++) {
          let a = (data[i].powderCount / data[i].powderAll).toFixed(2) * 100;
         
          this.bottonList.push(a);
        }
      })
      .catch(() => {});
  },
  methods: {},
};
</script>
<style scoped>
.oa0 {
  background: #efd816 !important;
}

.or0 {
  box-shadow: inset 0px -5px 10px 1px #efd816 !important;
  background: linear-gradient(0deg, #efd816 0%, #ffe50a 100%) !important;
}

.main >>> .el-switch__core {
  border-radius: 5px;
}

.top {
  margin: 40px auto 0 auto;
  background: url("../../assets/img/title/bgtt.webp");
  width: 1866px;
  height: 318px;
  background-size: 1866px 318px;
  position: relative;
}

.blueI {
  width: 40px;
  height: 20px;
  background: #25bbff;
  border-radius: 8px;
  margin-right: 10px;
}

.blueII {
  width: 40px;
  height: 20px;
  background: #efd816;
  border-radius: 8px;
  margin-right: 10px;
}

.text20 {
  width: 40px;
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #ffffff;
}
.ya {
  width: 70px;
  height: 70px;
  line-height: 70px;
  border-radius: 50%;
  display: inline-block;
  text-align: center;
  color: #ffffff;
  margin: auto;
  background: url("../../assets/img/title/cicle3.png") no-repeat;
}
.yaa {
  width: 90px;
  height: 90px;
  line-height: 90px;
  border-radius: 50%;
  display: inline-block;
  text-align: center;
  color: #ffffff;
  margin: auto;
  background: url("../../assets/img/title/cicle4.png") no-repeat;
}
.yelle {
  background: url("../../assets/img/title/cicle1.png") no-repeat;
  background-size: 100% 100%;
  color: #00adfe;
}

.yellea {
  background: url("../../assets/img/title/cicle2.png") no-repeat;
  background-size: 100% 100%;
  color: #00adfe;
}

.sizeS {
  font-size: 12px;
}

.top_top {
  position: absolute;
  right: 20px;
  top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top_top > div {
  display: inline-block;
}

.top_main {
  display: flex;
}

.top_main > div {
  margin: 30px 13px;
}

.title {
  font-size: 18px;
  color: #ffffff;
  text-align: center;
}

.title_s {
  font-size: 14px;
  text-align: center;
  color: #ffffff;
  height: 19px;
}

.title_b {
  font-size: 16px;
  text-align: center;
  color: #00f6ff;
}

.bottom {
  display: flex;
}

.bottom_main {
  width: 1100px;
  position: relative;
  margin-top: 35px;
  margin: 35px auto 0 auto;
}

._title {
  text-align: center;
  color: #00f6ff;
  line-height: 60px;
}

.switch {
  color: #ffffff;
  font-size: 16px;
  width: 60px;
  text-align: center;
  margin: 0px auto 13px auto;
}

.bei4 {
  background: url("../../assets/img/title/b1.webp") no-repeat;
  width: 80px;
  background-size: 100% 100%;
}

.bei3 {
  background: url("../../assets/img/title/b2.webp") no-repeat;
  width: 80px;
  background-size: 100% 100%;
}

.bei2 {
  background: url("../../assets/img/title/b3.webp") no-repeat;
  width: 80px;
  background-size: 100% 100%;
}

.bei1 {
  background: url("../../assets/img/title/b4.webp") no-repeat;
  width: 80px;
  background-size: 100% 100%;
}

.four_b > div {
  padding-top: 5px;
  display: inline-block;
  height: 54px;
  color: #00f6ff;
}

.bg {
  margin: 3px 0;
  width: 160px;
  border-radius: 0px 0px 5px 5px;
  height: 200px;
  background: #050c24;
  z-index: 99;
  position: relative;
  box-shadow: inset 0px 0px 5px 5px #000000;
}

.bgTop {
  width: 154px;
  height: 20px;
  left: 1px;
  top: -20px;
  position: absolute;
  background: #25bbff;
  border-radius: 2px 2px 0px 0px;
  color: #f16511;
  text-align: center;
  -webkit-transform: skew(-10deg);
  transform: skew(-5deg);
}

.bgBottom {
  box-shadow: inset 0px -5px 10px 1px #00b4ff;
  width: 154px;
  position: absolute;
  border-radius: 0px 0px 5px 5px;
  bottom: 3px;
  left: 3px;
  background: -webkit-gradient(
    linear,
    left bottom,
    left top,
    from(#0070e3),
    to(#00b4ff)
  );
  background: linear-gradient(0deg, #0070e3 0%, #00b4ff 100%);
}
</style>
